Selective serotonin reuptake inhibitors (SSRIs) are a class of medications commonly prescribed to treat depression, anxiety, and other mental health conditions. They work by increasing the availability of serotonin, a neurotransmitter that helps regulate mood. Due to their broad application and generally favourable side effect profile, SSRIs are a key indicator of prescribing patterns linked to mental health needs within populations (Madsen et al., 2015). Mental health, however, is not static and can be influenced by various external factors, including environmental changes. Seasonal fluctuations in mood and mental health, often referred to as Seasonal Affective Disorder (SAD), are well-documented in medical literature (Lam et al., 2006). SAD is typically triggered by reduced daylight in the autumn and winter months, leading to symptoms such as low mood, anxiety, and feelings of hopelessness. While not everyone who experiences seasonal mood shifts meets the criteria for SAD, many individuals seek medical intervention, often in the form of antidepressant prescriptions (Harmatz et al., 2000).
In Scotland, where seasonal variations are pronounced—such as extended periods of darkness in winter and unpredictable weather—these environmental factors may exacerbate mental health challenges. This could contribute to increased SSRI prescriptions during certain times of the year. Previous studies have shown that seasonal trends in antidepressant prescribing are influenced not only by environmental factors but also by societal pressures and healthcare access(Jack et al., 2023).
This report examines the seasonal trends in SSRI prescriptions across Scotland’s three major health boards, which represent the largest and primarily urban populations. Using the Public Health Scotland prescribing data, available here: https://www.opendata.nhs.scot/dataset/prescriptions-in-the-community
The analysis aims to identify whether SSRI prescriptions show distinct seasonal patterns. While this analysis focuses solely on SSRI prescription data and does not include specific conditions for which they are prescribed. Any suggested causes for these trends are speculative, as the data is limited to prescription counts rather than diagnoses or underlying factors.
By presenting these patterns, this report aims to contribute to a better understanding of SSRI use across Scotland’s major health boards and highlight areas for further investigation into the broader factors that may drive these trends.
Load Necessary Libraries
#load necessary libraries
library(tidyverse)
library(janitor)
library(gt)
library(here)
library(plotly)
# Function to process prescription data from multiple CSV files
process_prescription_data <- function(file_paths, health_boards) {
# Step 1: Load and combine the files
processed_data <- map_dfr(file_paths, ~ {
message("Processing file: ", .x) # Debugging log
# Read the file, select relevant columns and filter relevant rows
read_csv(.x, col_types = cols()) %>%
select(HBT2014, BNFItemDescription, PaidQuantity, PaidDateMonth) %>%
filter(str_detect(BNFItemDescription, "^(SERTRALINE|PAROXETINE|FLUOXETINE|CITALOPRAM|ESCITALOPRAM)") &
HBT2014 %in% health_boards)})
# Step 2: Cleaning and transforming the data by using mutate
full_prescribed_data <- processed_data %>%
mutate( # Retaining the PaidDateMonth in YYYYMMDD format
PaidDateMonth = sprintf("%06d", as.numeric(PaidDateMonth)), PaidDateMonth = paste0(PaidDateMonth, "01"),
# Appending day to create YYYYMMDD format as string
PaidDate = as.Date(PaidDateMonth, format = "%Y%m%d"), # Convert to Date object
Year = format(PaidDate, "%Y"), # Extract Year as string
# Create Season column based on PaidDate
Season = case_when(
format(PaidDate, "%m") %in% c("12", "01", "02") ~ "Winter",
format(PaidDate, "%m") %in% c("03", "04", "05") ~ "Spring",
format(PaidDate, "%m") %in% c("06", "07", "08") ~ "Summer",
format(PaidDate, "%m") %in% c("09", "10", "11") ~ "Autumn",
TRUE ~ "Unknown") ) %>%
# Recode health boards to be more readable
mutate(HealthBoard = recode(HBT2014,
"S08000032" = "Lanarkshire",
"S08000031" = "Greater Glasgow & Clyde",
"S08000024" = "Lothian",
"S08000023" = "Lanarkshire",
"S08000021" = "Greater Glasgow & Clyde")) %>%
select(-HBT2014) # Drop the original HBT2014 column
return(full_prescribed_data)}
# 2019 prescription data
pitc_list <- list.files(path = "C:/Users/wurao/OneDrive/Documents/data_science/B205492/docs",
pattern = "pitc2019.*\\.csv$", full.names =TRUE)
health_boards <- c("S08000032", "S08000031", "S08000024")
# Process the data using the updated function
processed_data_2019 <- process_prescription_data(pitc_list, health_boards)
# Summarize total prescriptions by Health Board, Season, Year
seasonal_data <- processed_data_2019 %>%
group_by(HealthBoard, Season, Year, ) %>%
summarise( "Total prescriptions" = sum(PaidQuantity, na.rm = TRUE), .groups = 'drop')
Figure 1
seasonal_data <- seasonal_data %>%
mutate(HealthBoard = str_trim(HealthBoard)) #to remove any leading or trailing whitespace characters from the HealthBoard column in the dataset
seasonal_plot <- seasonal_data %>%
ggplot(aes(x = Season, y = `Total prescriptions`, group = HealthBoard, color = HealthBoard)) +
geom_line(linewidth = 1.2) + # Line plot with specified line width
geom_point(size = 3) + # Add points to the plot
labs(title = "2019 Seasonal Patterns of SSRI Antidepressant Use Across Health Boards", x = "Season",y = "Total Prescriptions" ) +
theme_minimal() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Rotate x-axis labels
# Print the plot
print(seasonal_plot)
The visualization of SSRI prescriptions across Scotland’s three major health boards in 2019 suggests a notable seasonal trend. Prescription rates appear to peak in the autumn months across NHS Greater Glasgow & Clyde, NHS Lanarkshire, and NHS Lothian, followed by a noticeable decline in winter, with spring and summer showing moderate levels. although this was unexpected this pattern implies a possible cycle where prescription demand rises as autumn approaches and diminishes in winter. To understand if this trend is consistent, further analysis will involve expanding the dataset to cover the 3 years prior. By examining a longer period,it will highlight whether these seasonal fluctuations are stable over time or influenced by other factor.
# Step 1: Listing Relevant CSV Files
pitc_list <- list.files(path = here("docs"),
pattern = "pitc(2016|2017|2018)(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\.csv$",
full.names = TRUE)
if (length(pitc_list) == 0) { stop("No matching files found. Check the file names or pattern.")}
# Step 2: Apply the function to process the files
health_boards <- c("S08000023", "S08000021", "S08000024") # Customize this as needed
three_years_data <- process_prescription_data(pitc_list, health_boards)
Figure 2
# Summarize Data
Bar_prescribed_data <- three_years_data %>%
group_by(Season, Year, HealthBoard,) %>%
summarize(`Total prescriptions` = sum(PaidQuantity, na.rm = TRUE), .groups = "drop")
# Bar Plot with ggplot2
p <- ggplot(Bar_prescribed_data, aes(x = Season, y = `Total prescriptions`, fill = Season, text = `Total prescriptions`)) +
geom_bar(stat = "identity", position = position_dodge(width = 5), width = 0.9) + # Adjusting spacing and bar width
facet_grid(
rows = vars(HealthBoard), # Using rows for HealthBoard
cols = vars(Year),
scales = "free_y", # Adjust y-scales independently
labeller = label_wrap_gen(width = 15) # Wrap long facet labels
) + labs(
title = "Seasonal Patterns of SSRI Prescriptions by Year and Health Board",
x = "Season",
y = "Total Prescriptions"
) + theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), # Rotating x-axis labels
strip.text = element_text(face = "bold", size = 10, hjust = 0.5), # Center facet labels
plot.margin = margin(30, 50, 30, 30), # Increase right margin for more space
legend.position = "none",
plot.title = element_text(hjust = 0.5, size = 10, face = "bold") # Center the plot title
) + scale_fill_manual(values = c("Winter" = "blue", "Spring" = "green", "Summer" = "orange", "Autumn" = "brown")) +
coord_cartesian(clip = "off") # Prevent clipping of text outside plot area
# Convert ggplot to Interactive Plotly Plot
interactive_plot <- ggplotly(p, tooltip = c("x", "y", "text"))
# Show the Interactive Plot
interactive_plot
In Figure 2, data from 2016 to 2018 show consistent seasonal trends in SSRI prescriptions across Greater Glasgow & Clyde, Lanarkshire, and Lothian. In 2016, Autumn had the highest prescriptions: 8.88 million in Greater Glasgow & Clyde, 5.05 million in Lanarkshire, and 5.28 million in Lothian, with Winter consistently the lowest. Similar patterns were observed in 2017 and 2018, with Autumn prescriptions rising to 9.71 million in Greater Glasgow & Clyde, 5.61 million in Lanarkshire, and 5.83 million in Lothian by 2018.
Autumn consistently showed the highest prescription totals, followed by Spring and Summer, while Winter remained the lowest. These stable patterns across all health boards reinforce a seasonal cycle in prescribing habits, further explored through monthly data for more granular insights.
Figure 3
# Summarize the data and prepare for plotting
monthly_data <- three_years_data %>%
group_by(Year, HealthBoard, PaidDateMonth,Season) %>% # Ensure columns are correctly grouped
summarize(`Total prescriptions` = sum(PaidQuantity, na.rm = TRUE), .groups = "drop") %>%
# Create a Month_Factor to order months starting with March
mutate(Month_Factor = factor(format(as.Date(PaidDateMonth, format = "%Y%m%d"), "%b"), # Extract abbreviated month name from the date
levels = c("Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb")))
# Plot the monthly trends with seasons
ggplot(monthly_data, aes(x = Month_Factor, y = `Total prescriptions`, group = Season, color = Season)) +
geom_line(size = 1) + # Line plot with color for Season
geom_point(size = 2) + # Adding points for better visibility
facet_grid(HealthBoard ~ Year, labeller = labeller(HealthBoard = label_wrap_gen(15)) # Wrap labels for HealthBoard
) + labs( title = "Monthly Trends in SSRI Prescriptions by Health Board, Year, and Season", x = "Month", y = "Total Prescriptions",color = "Season" ) + scale_color_manual(values = c("Winter" = "blue", "Spring" = "green","Summer" = "orange", "Autumn" = "brown")) + # Custom colors for seasons
theme_minimal() + theme( axis.text.x = element_text(angle = 45, hjust = 1), # Rotate x-axis labels
strip.text = element_text(face = "bold", size = 10),
legend.position = "bottom", # Legend below the plot
plot.title = element_text(hjust = 0.5), # Center the plot title
strip.text.y = element_text(margin = margin(r = 10)), # Add margin to HealthBoard labels
plot.margin = margin(t = 10, r = 10, b = 10, l = 20) # Increase overall plot margins
)
Observation of figure 3 shows that across the three years, autumn into the start of winter, particularly October, November, and December, consistently showed the highest SSRI prescription totals for most of Scotland’s major health boards. For Greater Glasgow and Clyde, October was the highest in 2018, followed by November in 2017. In Lothian, December was the peak month across all three years, and for Lanarkshire, November was the highest for 2017 and 2016, with August being the peak month for 2018. This pattern suggests that the autumn and early winter months—October, November, and December—tend to see higher SSRI prescriptions. This details could not be seen in the previous plots due to the aggregation of the months. However, observing the individual months provide insight into the finer details within each year.
# Combine 2016-2018 and 2019 datasets
combined_prescribed_data <- bind_rows(Bar_prescribed_data, seasonal_data)
# Create the gt table
gt_table <- combined_prescribed_data %>%
arrange(Year, HealthBoard, Season) %>%
gt(rowname_col = "Season", groupname_col = "Year") %>%
tab_header(
title = md("**Seasonal Trends in SSRI Prescriptions Across Major Scottish Health Boards (2016-2019)**"),
subtitle = "Overview of Seasonal Prescription Totals by Health Board" )%>%
cols_label(
Year = "Year",
HealthBoard = "Health Board",
Season = "Season",
`Total prescriptions` = "Total Prescriptions") %>%
fmt_number(columns = `Total prescriptions`,decimals = 0 # No decimals for prescription counts
) %>%
tab_style(style = cell_text(weight = "bold"),locations = cells_row_groups(groups = TRUE) # Bold year group labels
) %>%
tab_options(
row_group.as_column = TRUE,
table.font.size = 14, # Larger font size for readability
data_row.padding = px(10),
column_labels.font.size = 16, # Bigger column headers
heading.border.bottom.color = "gray85",
heading.border.bottom.width = px(2)) %>%
tab_spanner(
label = "Health Board and Season",
columns = c("HealthBoard", "Season")) %>%
tab_style(
style = cell_fill(color = "lightgray"),
locations = cells_body(rows = seq(1, nrow(combined_prescribed_data), by = 2)) # Even rows
) %>%
tab_style( style = cell_fill(color = "lightblue"),
locations = cells_body(rows = seq(2, nrow(combined_prescribed_data), by = 2)) # Odd rows
) %>%
tab_style(style = cell_text(align = "center"),
locations = cells_body() # Center align body cells
) %>%
tab_style(style = cell_text(align = "center"),
locations = cells_column_labels() # Center align column headers
) %>%
tab_style(style = cell_text(weight = "bold", color = "darkblue"),
locations = cells_column_labels(columns = c("Year", "HealthBoard"))) %>%
tab_style(style = cell_text(weight = "normal", color = "black"),
locations = cells_body(columns = c("Year", "HealthBoard", "Season"))) %>%
tab_options(table.width = pct(100), # Set the table to take up 100% of the width
table.align = "center" # Align the table to the center
)
# Display the formatted table
gt_table
| Seasonal Trends in SSRI Prescriptions Across Major Scottish Health Boards (2016-2019) | |||
| Overview of Seasonal Prescription Totals by Health Board | |||
|
Health Board and Season
|
Total Prescriptions | ||
|---|---|---|---|
| Health Board | |||
| 2016 | Autumn | Greater Glasgow & Clyde | 8,884,463 |
| Spring | Greater Glasgow & Clyde | 8,821,739 | |
| Summer | Greater Glasgow & Clyde | 8,940,972 | |
| Winter | Greater Glasgow & Clyde | 8,594,210 | |
| Autumn | Lanarkshire | 5,052,455 | |
| Spring | Lanarkshire | 5,042,549 | |
| Summer | Lanarkshire | 5,104,842 | |
| Winter | Lanarkshire | 4,966,728 | |
| Autumn | Lothian | 5,280,164 | |
| Spring | Lothian | 5,249,669 | |
| Summer | Lothian | 5,296,597 | |
| Winter | Lothian | 5,121,263 | |
| 2017 | Autumn | Greater Glasgow & Clyde | 9,272,569 |
| Spring | Greater Glasgow & Clyde | 9,212,639 | |
| Summer | Greater Glasgow & Clyde | 9,285,008 | |
| Winter | Greater Glasgow & Clyde | 8,941,147 | |
| Autumn | Lanarkshire | 5,317,885 | |
| Spring | Lanarkshire | 5,242,997 | |
| Summer | Lanarkshire | 5,330,759 | |
| Winter | Lanarkshire | 5,125,656 | |
| Autumn | Lothian | 5,529,307 | |
| Spring | Lothian | 5,528,153 | |
| Summer | Lothian | 5,501,288 | |
| Winter | Lothian | 5,382,146 | |
| 2018 | Autumn | Greater Glasgow & Clyde | 9,706,148 |
| Spring | Greater Glasgow & Clyde | 9,537,012 | |
| Summer | Greater Glasgow & Clyde | 9,729,360 | |
| Winter | Greater Glasgow & Clyde | 9,391,876 | |
| Autumn | Lanarkshire | 5,612,085 | |
| Spring | Lanarkshire | 5,444,050 | |
| Summer | Lanarkshire | 5,629,655 | |
| Winter | Lanarkshire | 5,376,101 | |
| Autumn | Lothian | 5,832,617 | |
| Spring | Lothian | 5,755,843 | |
| Summer | Lothian | 5,768,094 | |
| Winter | Lothian | 5,670,963 | |
| 2019 | Autumn | Greater Glasgow & Clyde | 10,234,142 |
| Spring | Greater Glasgow & Clyde | 10,062,044 | |
| Summer | Greater Glasgow & Clyde | 10,189,077 | |
| Winter | Greater Glasgow & Clyde | 6,630,138 | |
| Autumn | Lanarkshire | 5,931,818 | |
| Spring | Lanarkshire | 5,840,297 | |
| Summer | Lanarkshire | 5,946,353 | |
| Winter | Lanarkshire | 3,863,237 | |
| Autumn | Lothian | 6,210,689 | |
| Spring | Lothian | 6,141,095 | |
| Summer | Lothian | 6,104,339 | |
| Winter | Lothian | 6,017,089 | |
This study analysed seasonal patterns in SSRI prescriptions across Scotland’s three major health boards, revealing trends consistent with previous research conducted in northern countries. Prescription rates exhibited clear seasonal variation, with higher rates observed during autumn into the start of winter, which may be influenced by environmental and behavioural factors.
The findings in this report align with research by Harmatz et al. (2000) in the United States, which observed increased antidepressant use during autumn and winter, correlating with seasonal affective disorder (SAD). Reduced sunlight during winter months can exacerbate depressive symptoms, as sunlight plays a significant role in regulating circadian rhythms and serotonin levels. Scotland’s high latitude, characterized by particularly short winter days, may intensify this seasonal effect. Contrastingly, Sato et al. (2013) found less pronounced seasonal trends in antidepressant use in Japan. This disparity may reflect cultural differences in mental health stigma, healthcare access, and prescribing practices, as well as Japan’s milder seasonal variations compared to Scotland. Such findings underscore the complex interplay of environmental, social, and healthcare system factors that shape prescription trends.
The seasonal trends identified in this study likely result from a combination of factors. Reduced sunlight during winter, as discussed by Lam et al. (2006), is a well-documented physiological driver of seasonal depressive symptoms. Furthermore, public awareness campaigns and mental health initiatives during certain months may also influence healthcare-seeking behaviour and, ultimately, prescription rates. The observed autumn peak in SSRI prescriptions could be attributed to transitional stressors, such as the start of the academic year and its associated pressures, which may particularly affect students and parents. Additionally, the approach of the festive season, often a source of social and financial strain, could exacerbate existing mental health challenges, leading to increased healthcare utilization during this period (Jack et al., 2023).
The variations observed across Scotland’s three major health boards may reflect differences in healthcare access, urbanization, and demographic characteristics. The more Urban areas such as Greater Glasgow & Clyde often exhibit more pronounced seasonal patterns, possibly due to better access to healthcare services. Conversely, the less urban populations may face barriers such as greater distances to care facilities, which could dampen observable trends in those regions.
This study provides valuable insights into SSRI prescription patterns but is subject to several limitations. The analysis focuses solely on SSRIs, excluding other antidepressant classes that might exhibit different seasonal trends. Moreover, the lack of individual-level diagnostic information limits the ability to directly associate prescriptions with specific conditions such as SAD. For future direction research would benefit from addressing these limitations by incorporating demographic data, examining the usage patterns of non-SSRI antidepressants. Expanding the study’s geographic scope to include rural and remote areas which could provide a more comprehensive understanding of the role of healthcare access in seasonal variations.
This study contributes to the growing body of evidence that seasonal factors influence SSRI prescribing patterns, particularly in high-latitude regions like Scotland. By exploring these trends, policymakers and healthcare providers can better understand the drivers of mental health treatment demand and implement strategies to improve the accessibility and timing of mental health care.
how AI helped me?
Function Development: Used AI to assist/polish in creating an R function for automating seasonal data filtering and summarization, streamlining the analysis process across multiple datasets. It also helped with struggle i had with my visualization such as giving ideas such as:Wrapping long facet labels when nothing was helping my labels not get cut off and recommending coord_cartesian.